<div class="container-fluid" style="margin-top: 10px;">
    <div class="row">
        <form id="inputForm" action="edit">
            <input type="hidden" name='TYPE_ID' value="{$data.TYPE_ID}">
            {:form('text',['title'=>'分类号','value'=>$data.TYPE_ID,'disable'=>'disabled'])}
            {:form('text',['title'=>'库存分类名称','name'=>'TYPE_NAME','value'=>$data.TYPE_NAME])}
            {:form('text',['title'=>'计量单位','name'=>'UNIT','value'=>$data.UNIT])}
            {:form('text',['title'=>'库存下限预警','name'=>'LOWER_LIMIT','value'=>$data.LOWER_LIMIT])}
            <div class="col-sm-12" style="margin-top: 10px;margin-bottom: 20px;text-align: center">
                <button id="addButton" type="button" class="btn btn-info btn-sm">保存</button>
                <button type="reset" class="btn btn-default btn-sm">重置</button>
            </div>
        </form>
    </div>
</div>

<script>

    $(function () {
        $("#addButton").on('click',function () {
            layer.confirm('确认更新信息吗？',function (index) {
                layer.close(index);
                layer.load();
                $("#inputForm").ajaxSubmit(function (text) {
                    console.log(text);
                    layer.closeAll('loading');
                    var json = JSON.parse(text);
                    if(json['code'] == '200'){
                        layer.alert(json['msg'],{icon:1},function (index) {
                            layer.close(index);
                            parent.location.reload();
                        })
                    }
                    else{
                        layer.alert(json['msg'],{icon:2});
                    }
                });
            });
        });
    });

</script>